home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_03 / xmpl_01.sx next >
Encoding:
Text File  |  1996-05-21  |  1.0 KB  |  50 lines  |  [TEXT/ttxt]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 3, example 1
  5.  
  6. -- create a module so that names used previously will not conflict
  7. -- with names used here
  8. module Scratch10 uses ScriptX end
  9. in module Scratch10
  10.  
  11. -- declare all the global variables we use in these examples
  12.  
  13. global myStencil, rectangular, myNewRect, myOtherNewRect, rect1
  14. global myRect2, bigArray
  15.  
  16. -- creating objects
  17.  
  18. -- new method
  19. myStencil := new Path 
  20. new LinkedList
  21.  
  22. myRect2 := new Rect x2:500 y2:500
  23. bigArray := new Array initialSize:150
  24.  
  25. rectangular := new TwoDShape \
  26.     stencil:(new Rect x2:500 y2:500)
  27.  
  28. -- object expression
  29. object (Rect) x1:35, y1:35, x2:50, y2:50 end
  30.  
  31. object (Rect)
  32.     x1:35, y1:35
  33.     x2:50, y2:50
  34. end
  35.  
  36. object (Array)
  37.     initialSize:100
  38.     growSize:10
  39. end
  40.  
  41. object myNewRect (Rect) x2:100, y2:100 end
  42. myOtherNewRect := object (Rect) x2:100, y2:100 end
  43.  
  44. rect1 := object (TwoDShape)
  45.     fill:(new Brush color:redColor) -- keyword argument
  46.     stroke:(new Brush color:greenColor) -- keyword argument
  47.     settings
  48.         x:50, y:50
  49. end
  50. -->>>